package com.wxl.shiyan2.wxl;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

/**
 * @ClassName CustomCommandLineRunner
 * @Description TODO
 * @Author wangxiangling
 **/
@SuppressWarnings("unused")
public class CustomCommandLineRunner implements CommandLineRunner {
    Environment env;

    public CustomCommandLineRunner(Environment env){
        this.env = env;
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("利用srping Boot自动装配的CommandLineRunner.");
        System.out.println("生成一个随机字符串: ".concat(Objects.requireNonNull(env.getProperty("random."))) );
    }
}
